/*
date:20210304 pm15:26
key:1.每轮循环mod一次即可，递归会超时。
*/
#include<math.h>
#include <stdio.h>

#include<iostream>
#include<sstream>
#include<stdlib.h>
using namespace std;
const int P = 10007;
long hex_int(string s, int base)
{
	//string转成字符数组
	char* s1 = new char[s.size()];
	for (int i = 0; i < s.size(); i++)
	{
		s1[i] = s[i];

	}
	char* s2;
	//以base为底的数字以字符数组输入，得到10进制对应数字
	return strtol(s1, &s2, base);
}
int jiecheng(int n)
{
	int j = 1;
	for (int i = 1; i <= n; i++)
	{
		j = j * i;
	}
	return j;
}
int f(int n)
{	
	//每行第一个和最后一个是1
	if (n==2 ||n==1 )
	{
		return 1;
	}
	//其次由两肩组成
	else
	{
		return (f(n - 1) + f(n-2))%P;
	}
}

int main()
{
	
	int n;
	cin >> n;
	int a = 1;
	int b = 1;
	int c = 0;
	for (int i = 1; i <= n; i++)
	{
		if (i == 1|| i == 2)
		{
			c = 1;
		}
		else
		{
			a = b;
			b = c;
			c = (a + b)%P;
		}
	}
	cout << c;
	

	
}
